package edu.towson.android.graphgrammar.activity;

import java.io.File;
import java.util.List;

import org.w3c.dom.Node;

import edu.towson.android.graphgrammar.activity.impl.ReaderWritterFactory;

public class AndriodActivitiesHandler {

	public static File handleWithVersion1(File manifestFile,
			String fullPathFileName) throws ActivityException {
		IActivityToGraphxmlWriter writer = null;
		IActivityFromManifestReader reader = null;
		List<Node> activitesNodes = null;
		try {
			reader = ReaderWritterFactory.getReaderImplVersion1();
			writer = ReaderWritterFactory.getWriterImplVersion1();

			activitesNodes = reader.getActivities(manifestFile);
			return writer.writeToFile(activitesNodes, fullPathFileName);

		} catch (ActivityException ae) {
			throw ae;
		} catch (Exception e) {
			throw new ActivityException("Failed to handle", e);
		}
	}
}
